package CeSi;
/*
1.请定义一个交通工具(Vehicle)的类其中有:
属性： 速度(speed)、 体积(size)等，方法：移动(move())、设置速度(setSpeed(int speed))、加速 speedUp()、减速 speedDown()等。
最后在测试类 Vehicle 中的 main()中实例化一个交通工具对象并通过方法给它初始化 speed,size 的值并且通过打印出来。另外调用加速、减速的方法对速度进行改变。
 */
public class Test01 {
    public static void main(String[] args) {
        Vehicle a=new Vehicle();
        a.setSpeed(2);
        double v1 = a.speedDown();
        double v = a.speedUp();
        System.out.println(v1+v);
    }
}
class Vehicle{
    private double speed;
    private double size;

    public Vehicle() {
    }

    public Vehicle(double speed, double size) {
        this.speed = speed;
        this.size = size;
    }

    public double getSpeed() {
        return speed;
    }

    public void setSpeed(double speed) {
        this.speed = speed;
    }

    public double getSize() {
        return size;
    }

    public void setSize(double size) {
        this.size = size;
    }
    public static void move(){
        System.out.println("移动");
    }
    public void setSpeed(){
        System.out.println(speed);
    }
    public double speedUp(){
        double speedUp=speed+1.0;
        return speedUp;
    }
    public double speedDown(){
        double speedDown=speed-1.0;
        return speedDown;
    }
}
